import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/",
    redirect: "/home",
  },
  {
    path: "/home",
    component: () => import("../views/home/FirstIndex.vue"),
    children:[
      {
        path:"/home",
        redirect:"/home/index",
      },
      {
        path:"/home/index",
        component:()=>import("../views/home/FirstHome.vue")
      },
      {
        path: "/home/shangpin",
        component: () => import("../views/home/ShangPin.vue"),
        children: [
          {
            path: "/home/shangpin",
            redirect: "/home/shangpin/fabu",
          },
          {
            path: "/home/shangpin/fabu",
            component: () => import("../components/shangpin/FaBu.vue"),
          },
          {
            path: "/home/shangpin/wode",
            component: () => import("../components/shangpin/WoDe.vue"),
          },
          {
            path: "/home/shangpin/zhuangxiu",
            component: () => import("../components/shangpin/ZhuangXiu.vue"),
          },
        ],
      },
      {
        path: "/home/jiaoyi",
        component: () => import("../views/home/JiaoYi.vue"),
        children: [
          {
            path: "/home/jiaoyi",
            redirect: "/home/jiaoyi/dingdan",
          },
          {
            path: "/home/jiaoyi/dingdan",
            component: () => import("../components/jiaoyi/DingDan.vue"),
          },
          {
            path: "/home/jiaoyi/fahuo",
            component: () => import("../components/jiaoyi/FaHuo.vue"),
          },
          {
            path: "/home/jiaoyi/tuikuan",
            component: () => import("../components/jiaoyi/TuiKuan.vue"),
          },
        ],
      },
      {
        path: "/home/dianpu",
        component: () => import("../views/home/DianPu.vue"),
        children: [
          {
            path: "/home/dianpu",
            redirect: "/home/dianpu/dianpu",
          },
          {
            path: "/home/dianpu/dianpu",
            component: () => import("../components/dianpu/DianPu.vue"),
          },
        ],
      },
      {
        path: "/home/tuiguang",
        component: () => import("../views/home/TuiGuang.vue"),
        children: [
          {
            path: "/home/tuiguang",
            redirect: "/home/tuiguang/tuiguang",
          },
          {
            path: "/home/tuiguang/tuiguang",
            component: () => import("../components/tuiguang/TuiGuang.vue"),
          },
        ],
      },
      {
        path: "/home/yonghu",
        component: () => import("../views/home/YongHu.vue"),
        children: [
          {
            path: "/home/yonghu",
            redirect: "/home/yonghu/yonghu",
          },
          {
            path: "/home/yonghu/yonghu",
            component: () => import("../components/yonghu/YongHu.vue"),
          },
        ],
      },
    ]
  },
  
  {
    path: "/:catchAll(.*)",
    name: "404",
    component: () => import("../views/NotFound.vue"),
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes,
});

export default router;
